﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public enum StatEnum
{
    Basic1,
    Basic2,
    SAM1,
    Rotative1
}

public class StatManager : MonoBehaviour {

    [SerializeField]
    private List<Stat> basicTurretStat;
    public List<Stat> BasicTurretStat
    {
        get { return basicTurretStat; }
        set { basicTurretStat = value; }
    }

    [SerializeField]
    private List<Stat> samTurretStat;
    public List<Stat> SAMTurretStat
    {
        get { return samTurretStat; }
        set { samTurretStat = value; }
    }

    [SerializeField]
    private List<Stat> rotativeTurretStat;
    public List<Stat> RotativeTurretStat
    {
        get { return rotativeTurretStat; }
        set { rotativeTurretStat = value; }
    }

    [SerializeField]
    public float DamageModifier { get; set; }

    private Dictionary<StatEnum, Stat> statDict;

	// Use this for initialization
	void Start () {
        DamageModifier = 1;
	}

    public void loadStat(Turret.Turret turret, Stat stat)
    {
        turret.ReloadTime = stat.ReloadTime;
        turret.TurnSpeed = stat.TurnSpeed;
        turret.FirePauseTime = stat.FirePauseTime;
        turret.ProjectileRange = stat.ProjectileRange;
        turret.ProjectileSpeed = stat.ProjectileSpeed;
        turret.ProjectileDamage = stat.ProjectileDamage * DamageModifier;
    }

    public string statToPrint(Stat stat)
    {
        return "Damage : " + stat.ProjectileDamage + "\n" + "Range : " + stat.ProjectileRange + "\n" + "Fire rate : " + (1 / stat.ReloadTime).ToString("F2") + "\n" + "Cost : " + getBuildCost(stat);
    }


    public int getBuildCost(Stat stat)
    {
        return (int)(stat.ProjectileDamage + 3 * stat.ReloadTime + stat.ProjectileRange / 5);
    }

	// Update is called once per frame
	void Update () {
	
	}


}
